using System.Collections.Generic;
using Betfair.Api.Types;
using Newtonsoft.Json;

namespace Betfair.Api
{
    public sealed class Params
    {
        [JsonProperty("filter", NullValueHandling = NullValueHandling.Ignore)]
        public Filter Filter { get; private set; }

        [JsonProperty("marketIds", NullValueHandling = NullValueHandling.Ignore)]
        public HashSet<string> MarketIds { get; private set; }

        [JsonProperty("maxResults", NullValueHandling = NullValueHandling.Ignore)]
        public int? MaxResults { get; private set; }

        [JsonProperty("marketProjection", NullValueHandling = NullValueHandling.Ignore)]
        public HashSet<MarketProjection> MarketProjections { get; private set; }

        [JsonProperty("priceProjection", NullValueHandling = NullValueHandling.Ignore)]
        public PriceProjection PriceProjection { get; private set; }

        public Params SetFilter(Filter filter)
        {
            Filter = filter;
            return this;
        }

        public Params SetMarketId(string marketId)
        {
            if (MarketIds == null)
                MarketIds = new HashSet<string>();
            MarketIds.Add(marketId);
            return this;
        }

        public Params SetMaxResult(int maxResult)
        {
            MaxResults = maxResult;
            return this;
        }

        public Params SetMarketProjection(MarketProjection marketProjection)
        {
            if (MarketProjections == null)
                MarketProjections = new HashSet<MarketProjection>();
            MarketProjections.Add(marketProjection);
            return this;
        }

        public Params SetPriceProjection(PriceProjection priceProjection)
        {
            PriceProjection = priceProjection;
            return this;
        }
    }
}